]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Only emit layout-changed when not updating pages
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 1 Sep 2020 18:41:44 +0000 (15:41 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 1 Sep 2020 19:45:54 +0000 (16:45 -0300)
It is wasteful to emit layout-changed when updating pages, because
the caller (AppDisplay) already has an updated state by the time
this is called.

Only emit 'layout-changed' if the GSettings notification doesn't
come from AppDisplay updating the pages.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1428

js/ui/appDisplay.js

index d26c12fec33423858795be137a6d7b7ab4d9740e..98ac9e68b0f8018f4817931b6e30b9041a33f4ae 100644 (file)
@@ -832,13 +832,15 @@ var PageManager = GObject.registerClass({
         global.settings.connect('changed::app-picker-layout',
             this._loadPages.bind(this));
 
+        this._updatingPages = false;
         this._loadPages();
     }
 
     _loadPages() {
         const layout = global.settings.get_value('app-picker-layout');
         this._pages = layout.recursiveUnpack();
-        this.emit('layout-changed');
+        if (!this._updatingPages)
+            this.emit('layout-changed');
     }
 
     getAppPosition(appId) {
@@ -869,8 +871,12 @@ var PageManager = GObject.registerClass({
             packedPages.push(pageData);
         }
 
+        this._updatingPages = true;
+
         const variant = new GLib.Variant('aa{sv}', packedPages);
         global.settings.set_value('app-picker-layout', variant);
+
+        this._updatingPages = false;
     }
 
     get pages() {